<?php 
set_time_limit(0);
ini_set("memory_limit", "12M");
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
include '../connection/connection.php';
$winH = 500;
	if(isset($_REQUEST['winH'])) $winH = $_REQUEST['winH'];
	
	//m_fromdate , m_todate:m_todate, s_monitor
	$s_monitor = $_REQUEST['s_monitor'];
	
	if($s_monitor=='0'){
		$recognizeList = mysql_query("select re.*,co.`name` from recognize re,configcamera co where re.cameraid=co.id and re.fromdate>='".$_REQUEST['m_fromdate']."' and re.todate<='".$_REQUEST['m_todate']."'",$connection);
	}else{
		$recognizeList = mysql_query("select re.*,co.`name` from recognize re,configcamera co where re.cameraid=co.id and re.fromdate>='".$_REQUEST['m_fromdate']."' and re.todate<='".$_REQUEST['m_todate']."' and co.id in (select camera_ID from favourite where monitor_ID='$s_monitor')",$connection);
	}
	$index_re = 0;
	$s_recognize = array();
	while($row_re = mysql_fetch_array($recognizeList)){
		$index_re +=1;
		array_push($s_recognize, array($row_re['name'],$row_re['total'],$row_re['unrecognize'],$row_re['recognize_fail'],$row_re['recognize_ok'],$row_re['percent'],$row_re['fromdate'],$row_re['todate'],$row_re['cameraid']));
		?>
	<tr>
		<td width="6%" align="center"><?=$index_re?></td>
		<td width="44%" align="center">
			<span onclick="OnSelect('<?=$row_re['fromdate']?>','<?=$row_re['todate']?>',<?=$row_re['cameraid']?>,<?=$row_re['total']?>,<?=$row_re['unrecognize']?>,<?=$row_re['recognize_fail']?>,<?=$row_re['recognize_ok']?>)" style="cursor:pointer;color:#035a97">
				<?=$row_re['name']?>
			</span>
		</td>
		<td width="10%" align="center"><?=$row_re['total']?></td>
		<td width="10%" align="center"><?=$row_re['unrecognize']?></td>
		<td width="10%" align="center"><?=$row_re['recognize_fail']?></td>
		<td width="10%" align="center"><?=$row_re['recognize_ok']?></td>
		<td width="10%" class="last" align="center" <?php if($row_re['percent'] == 100){?>style="color:#00FFB6"<?php }elseif($row_re['percent'] < 50 ){?>style="color:#FF3A3A"<?php }?>><?=$row_re['percent']."%"?></td>
	</tr>
	<?php }
	$_SESSION['s_recognizes'] = $s_recognize;
	if ($index_re<$winH/28) {
	 	foreach(range(0,$winH/28-$index) as $i){
	 		?>
	 		<tr>
	 		<td width="6%">&nbsp;</td>
		 	<td width="44%">&nbsp;</td>
		 	<td width="10%">&nbsp;</td>
		 	<td width="10%">&nbsp;</td>
		 	<td width="10%">&nbsp;</td>
		 	<td width="10%">&nbsp;</td>
		 	<td  width="10%"  class="last">&nbsp;</td>
		 	</tr>
	 	<?php }
	}
	
       		
mysql_close($connection);

?>  